﻿//
// XN4SL - Xna Framework for Silverlight.
//
using Xn4Sl.Framework.Input;
using System;
using System.Windows;
using System.Windows.Input;

namespace Xn4Sl.Framework.Utils
{
    /// <summary>
    /// Convert class for converting between XNA and Silverlight frameworks.
    /// </summary>
    public static class Convert
    {
        /// <summary>
        /// Converts System.Windows.Input.Key to Xn4Sl.Framework.Input.Keys.
        /// </summary>
        /// <param name="key">Key value to convert.</param>
        /// <returns>Converted Keys value.</returns>
        public static Keys ToKeys(Key key)
        {
            switch (key)
            {
                case Key.A: return Keys.A;
                case Key.Add: return Keys.Add;
                case Key.Alt: return Keys.LeftAlt;
                case Key.B: return Keys.B;
                case Key.Back: return Keys.Back;
                case Key.C: return Keys.C;
                case Key.CapsLock: return Keys.CapsLock;
                case Key.Ctrl: return Keys.LeftControl;
                case Key.D: return Keys.D;
                case Key.D0: return Keys.D0;
                case Key.D1: return Keys.D1;
                case Key.D2: return Keys.D2;
                case Key.D3: return Keys.D3;
                case Key.D4: return Keys.D4;
                case Key.D5: return Keys.D5;
                case Key.D6: return Keys.D6;
                case Key.D7: return Keys.D7;
                case Key.D8: return Keys.D8;
                case Key.D9: return Keys.D8;
                case Key.Decimal: return Keys.Decimal;
                case Key.Delete: return Keys.Delete;
                case Key.Divide: return Keys.Divide;
                case Key.Down: return Keys.Down;
                case Key.E: return Keys.E;
                case Key.End: return Keys.End;
                case Key.Enter: return Keys.Enter;
                case Key.Escape: return Keys.Escape;
                case Key.F: return Keys.F;
                case Key.F1: return Keys.F1;
                case Key.F10: return Keys.F10;
                case Key.F11: return Keys.F11;
                case Key.F12: return Keys.F12;
                case Key.F2: return Keys.F2;
                case Key.F3: return Keys.F3;
                case Key.F4: return Keys.F4;
                case Key.F5: return Keys.F5;
                case Key.F6: return Keys.F6;
                case Key.F7: return Keys.F7;
                case Key.F8: return Keys.F8;
                case Key.F9: return Keys.F9;
                case Key.G: return Keys.G;
                case Key.H: return Keys.H;
                case Key.Home: return Keys.Home;
                case Key.I: return Keys.I;
                case Key.Insert: return Keys.Insert;
                case Key.J: return Keys.J;
                case Key.K: return Keys.K;
                case Key.L: return Keys.L;
                case Key.Left: return Keys.Left;
                case Key.M: return Keys.M;
                case Key.Multiply: return Keys.Multiply;
                case Key.N: return Keys.N;
                case Key.None: return Keys.None;
                case Key.NumPad0: return Keys.NumPad0;
                case Key.NumPad1: return Keys.NumPad1;
                case Key.NumPad2: return Keys.NumPad2;
                case Key.NumPad3: return Keys.NumPad3;
                case Key.NumPad4: return Keys.NumPad4;
                case Key.NumPad5: return Keys.NumPad5;
                case Key.NumPad6: return Keys.NumPad6;
                case Key.NumPad7: return Keys.NumPad7;
                case Key.NumPad8: return Keys.NumPad8;
                case Key.NumPad9: return Keys.NumPad9;
                case Key.O: return Keys.O;
                case Key.P: return Keys.P;
                case Key.PageDown: return Keys.PageDown;
                case Key.PageUp: return Keys.PageUp;
                case Key.Q: return Keys.Q;
                case Key.R: return Keys.R;
                case Key.Right: return Keys.Right;
                case Key.S: return Keys.S;
                case Key.Shift: return Keys.LeftShift;
                case Key.Space: return Keys.Space;
                case Key.Subtract: return Keys.Subtract;
                case Key.T: return Keys.T;
                case Key.Tab: return Keys.Tab;
                case Key.U: return Keys.U;
                case Key.Unknown: return Keys.OemQuestion; // What we should return here?
                case Key.Up: return Keys.Up;
                case Key.V: return Keys.V;
                case Key.W: return Keys.W;
                case Key.X: return Keys.X;
                case Key.Y: return Keys.Y;
                case Key.Z: return Keys.Z;
                default: return Keys.OemQuestion;
            }
        }
    }
}
